app.controller("sellerController",function ($scope,$controller,sellerService) {
    //继承通用控制器
    $controller("commonController",{$scope:$scope});

    //添加商家
    $scope.addSeller=function(){

        sellerService.addSeller($scope.seller).success(
            function (response) {
                if (200 == response.code){
                    //注册成功跳转到一个页面
                    alert("注册成功，请等待审核")
                    location.href="http://localhost:8083";
                }else{
                    alert(response.message);
                }
            }
        );
    }

    //查询商家信息
    $scope.findOneSeller=function () {
        sellerService.findOneSeller().success(
            function (response) {
                $scope.entity=response;
            }
        );
    }
    //更新商家信息
    $scope.updateSeller=function () {
        sellerService.updateSeller($scope.entity).success(
            function (response) {
                if (200 == response.code){
                    location.reload();
                }else{
                    alert(response.message);
                }
            }
        );
    }

});